package springboot.config;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import springboot.interceptors.MyIntercepor;

@Configuration
public class MyWebMvcConfigurer implements WebMvcConfigurer {

    @Autowired
    private MyIntercepor intercepor;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {

        /* /** 所有路径
         * /* 当前层级所有路径，不向下递归遍历
         */
        registry.addInterceptor(intercepor).addPathPatterns("/**");
    }
}
